#GLOBAL
uniform float simulateSize;
uniform sampler2D NormalTexture;
uniform sampler2D BackgroundTexture;
#END

#VS
attribute vec3 Position0;
attribute vec2 Texcoord0;

out vec4 Position_VSPS;
out vec2 Texcoord_VSPS;

void main()
{
	gl_Position = Position_VSPS = vec4(Position0, 1);




	Texcoord_VSPS = Texcoord0;

}
#END

#PS
in vec4 Position_VSPS;
in vec2 Texcoord_VSPS;

out vec4 glFragColorOut[1];

void main()
{
	vec4 normal = texture2D(NormalTexture, Texcoord_VSPS);
	normal = (normal-0.5) * 2.0;

	float r = texture2D(BackgroundTexture, Texcoord_VSPS - (normal.xy * .4)).r;
	float g = texture2D(BackgroundTexture, Texcoord_VSPS - (normal.xy * .45)).g;
	float b = texture2D(BackgroundTexture, Texcoord_VSPS - (normal.xy * .5)).b;
	glFragColorOut[0] = vec4(r, g, b, 1);
}
#END

